{extend name='common/_container'}
{block name="content"}
<style>
    h3,h4{
        line-height: 40px;
    }
    .btn{
        background-color: #1C84C6;
        color: white;
        font-size: 14px;
    }
    .btn:hover{
        outline: none;
        color: white;
    }
</style>
<div class="ibox float-e-margins">
    <input type="hidden" name='id' id='id' value="{$info.id}" />
    <div class="row">
        <div class="col-sm-12" style="text-align: center">
            <div class="alert alert-success alert-dismissable">
                <h4>当前版本:{$config.version}</h4>
                {if $data['version']>$config['version'] }
                <h3 style="color: black">有新的版本，是否立即更新？</h3>
                <div class="btn" onclick="CodeInfoDlg.update()">立即更新</div>
                <h4>最新版本：{$data.version} &nbsp;&nbsp;&nbsp; 发布时间：{$data.cerate_time}</h4>
                <!--<?php echo $data.content; ?>-->
                <h4>更新内容：</h4>
                {$data.content}
                {/if}
            </div>
        </div>
    </div>
</div>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/plugins/layui/layui.js" charset="utf-8"></script>
<script>
    var CodeInfoDlg = {
        CodeInfoData: {},
        validateFields: {
        }
    }


    CodeInfoDlg.update = function () {
        console.log(11)
        // this.clearData();
        // this.collectData();
        // if (!this.validate()) {
        //     return;
        // }
        var ajax = new $ax(Feng.ctxPath + "/Version/test", function (data) {
            if ('00' === data.status) {
                console.log(data.data)
                Feng.success(data.msg,2000);
                // window.parent.CodeGoods.table.refresh();
                $.ajax({
                    url: Feng.ctxPath +"/Version/down",
                    type: 'POST',
                    data:{
                        url:data.data
                    },
                    success(res)
                    {
                        Feng.success(res.msg,1000);
                        location.reload();
                    }
                })
                CodeInfoDlg.close();
            } else {
                console.log(data,235465)
                Feng.error(data.msg + "！",1000);
            }
        })
        ajax.set(this.CodeInfoData);
        ajax.start();
    };


</script>
<script src="__PUBLIC__/static/js/base.js" charset="utf-8"></script>
{/block}
